<!--
描述：教学场地-新增组件
开发人：fwb
开发日期：2017年8月22日
-->

<template lang="pug">
    kalix-dialog.user-add(bizKey="teachSpace" ref="kalixBizDialog" v-bind:form-model.sync="formModel" v-bind:targetURL="targetURL")
        div.el-form(slot="dialogFormSlot")
            div.s-flex
                el-form-item.s-flex_item(label="所在校区" prop="szxqid" v-bind:label-width="labelWidth")
                    kalix-object-select-2(v-model="formModel.szxqid" v-bind:objectsUrl="schoolZoneURL" v-bind:label="'zwmc'")
                el-form-item.s-flex_item(label="场地类型" prop="cdlx" v-bind:label-width="labelWidth")
                    kalix-dict-select(v-model="formModel.cdlx"  appName="educational" dictType="场地类型" v-on:input="change($event)")
            template(v-if="formModel.cdlx === 0")
                div.s-flex
                    el-form-item.s-flex_item(label="楼房" prop="loufang" v-bind:label-width="labelWidth")
                        kalix-object-select-2(v-model="formModel.loufang" v-bind:objectsUrl="schoolBuildURL")
                    el-form-item.s-flex_item(label="楼层" prop="lc" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.lc")
                div.s-flex
                    el-form-item.s-flex_item(label="门牌号" prop="mph" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.mph")
                    el-form-item.s-flex_item(label="名称" prop="mc" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.mc")
                div.s-flex
                    el-form-item.s-flex_item(label="类型" prop="type"  v-bind:label-width="labelWidth")
                        kalix-dict-select(v-model="formModel.type"  appName="educational" dictType="教室类型" )
                    el-form-item.s-flex_item(label="容量" prop="rl"  v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.rl")
                div.s-flex
                    el-form-item.s-flex_item(label="状态" prop="zt" v-bind:label-width="labelWidth")
                        kalix-dict-select(v-model="formModel.zt"  appName="educational" dictType="状态" )
                    el-form-item.s-flex_item(label="使用单位" prop="sydw" v-bind:label-width="labelWidth")
                        kalix-dict-select(v-model="formModel.sydw"  appName="educational" dictType="使用单位" )
                div.s-flex
                    el-form-item.s-flex_item(label="默认考场容量" prop="mrgcrl" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.mrgcrl")
                    el-form-item.s-flex_item(label="使用面积" prop="symj" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.symj")
                div.s-flex
                    el-form-item.s-flex_item(label="备注" prop="bz" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.bz" type="textarea")
            template(v-else-if="formModel.cdlx === 1")
                div.s-flex
                    el-form-item.s-flex_item(label="楼房" prop="loufang" v-bind:label-width="labelWidth")
                        kalix-object-select-2(v-model="formModel.loufang" v-bind:objectsUrl="schoolBuildURL")
                    el-form-item.s-flex_item(label="楼层" prop="lc" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.lc")
                div.s-flex
                    el-form-item.s-flex_item(label="实验室" prop="sys" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.sys")
                    el-form-item.s-flex_item(label="门牌号" prop="mph" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.mph")
                div.s-flex
                    el-form-item.s-flex_item(label="院（系）/部" prop="yxbm" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.yxbm")
                    el-form-item.s-flex_item(label="占地面积" prop="zdmj" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.zdmj")
                div.s-flex
                    el-form-item.s-flex_item(label="建筑面积" prop="jzmj" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.jzmj")
                    el-form-item.s-flex_item(label="使用面积" prop="symj" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.symj")
                div.s-flex
                    el-form-item.s-flex_item(label="状态" prop="zt" v-bind:label-width="labelWidth")
                        kalix-dict-select(v-model="formModel.zt"  appName="educational" dictType="状态" )
                    el-form-item.s-flex_item(label="备注" prop="bz" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.bz" type="textarea")
            template(v-else-if="formModel.cdlx === 3")
                div.s-flex
                    el-form-item.s-flex_item(label="名称" prop="mc" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.mc")
                    el-form-item.s-flex_item(label="状态" prop="zt" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.zt")
                div.s-flex
                    el-form-item.s-flex_item(label="容量" prop="rl" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.rl")
                    el-form-item.s-flex_item(label="占地面积" prop="zdmj" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.zdmj")
                div.s-flex
                    el-form-item.s-flex_item(label="建筑面积" prop="jzmj" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.jzmj")
                    el-form-item.s-flex_item(label="使用面积" prop="symj" v-bind:label-width="labelWidth")
                        el-input(v-model="formModel.symj")
</template>

<script type="text/ecmascript-6">
    import FormModel from './model'
    import {SchoolBuildURL, schoolZoneURL, TeachSpaceURL} from '../../config.toml'

    export default {
        name: 'TeachSpaceAdd',
        data() {
            return {
                formModel: Object.assign({}, FormModel),
                rules: {
                    //  userId: [{type: 'number', required: true, message: '请输入学生姓名', trigger: 'change'}]
                },
                targetURL: TeachSpaceURL,
                schoolZoneURL: schoolZoneURL,
                schoolBuildURL: SchoolBuildURL,
                labelWidth: '120px'
            }
        },
        components: {},
        created() {
        },
        methods: {
            change(event) {
                this.$refs.kalixBizDialog.$refs.dialogForm.clearValidate()
            }
        }
    }
</script>

<style scoped lang="stylus">
    .el-form
        padding 30px 70px 30px 20px
</style>
